<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>开发框架</title>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <link rel="stylesheet" href="statics/css/bootstrap.min.css">
  <link rel="stylesheet" href="statics/css/font-awesome.min.css">
  <!--<link rel="stylesheet" href="statics/css/style.min.css">-->
  <!--<link rel="stylesheet" href="statics/css/common.min.css">-->
  <link rel="stylesheet" href="statics/css/xnet-login2.css">
   <script src="statics/libs/jquery.min.js"></script>
  <script>
      $(function () {
          initialPage();
          $(window).resize(function (e) {
              window.setTimeout(initialPage, 200);
              e.stopPropagation();
          });
      });
      function initialPage() {
          var wHeight = $(window).height();
          var wWidth = $(window).width();
          var topHeight = (wHeight - 524) / 2;
          var leftWidth = (wWidth - 1024) / 2;
          $(".sx-login-top").css("margin-top", (topHeight - 56) + "px");
          $(".menu").css("top", (topHeight + 50) + "px");
          $(".sx-bg-left").width(leftWidth);
          $(".sx-bg-right").width(leftWidth);
      }
  </script>

</head>
<body class="hold-transition">

<div class="" id="dpLTE" v-cloak>
    <body style="overflow-x:hidden;margin:0px;">
    <div class="sx-login-top">
        <div class="sx-login-title">
            <div class="sx-login-logo"></div>
        </div>
    </div>
    <div class="sx-login-center">
        <table>
            <tr>
                <td><div class="sx-bg-left"></div></td>
                <td>
                    <div class="sx-bg-md">
                        <div id="sx-login-form" class="sx-input-form">
                            <div v-if="error" class="alert alert-danger alert-dismissible" style="
                                 height: 40px;
                                 padding-top: 10px;"
                            >
                            <i class="fa fa-exclamation-triangle"></i> {{errorMsg}}
                            </div>
                            <div class="form-group has-feedback">
                            <input type="text" class="form-control" v-model="username" placeholder="账号">
                            <span class="glyphicon glyphicon-user form-control-feedback"></span>
                            </div>
                            <div class="form-group has-feedback">
                            <input type="password" class="form-control" v-model="password" placeholder="密码">
                            <span class="glyphicon glyphicon-lock form-control-feedback"></span>
                            </div>
                            <div class="form-group has-feedback">
                            <input type="text" class="form-control" v-model="captcha" @keyup.enter="login" placeholder="验证码">
                            <span class="glyphicon glyphicon-warning-sign form-control-feedback"></span>
                            </div>
                            <div class="form-group has-feedback">
                            <img alt="若无法看清，请单击图片刷新！" class="pointer" :src="src" @click="refreshCode">
                            &nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:;" style="font-size: 15px" @click="refreshCode">点击刷新</a>
                            </div>


                            <!--<div><input class="ipt" id="password" type="password" placeholder="密码" value=""></div>-->
                            <!--<div>-->
                                <!--<div style="float: left; width: 65%">-->
                                    <!--<input class="ipt" id="verifycode" maxlength="4" type="text" placeholder="图片验证码" value="">-->
                                <!--</div>-->
                                <!--<div style="float: left; width: 35%">-->
                                    <!--<img id="login_verifycode" class="img_verifycode" src="/Login/VerifyCode" width="100" height="30" alt="点击切换验证码"-->
                                         <!--title="点击切换验证码" style="cursor: pointer; padding-top: 19px; padding-left: 9px;" />-->
                                <!--</div>-->
                            <!--</div>-->

                            <div class="btn">
                                <button type="button" class="" @click="login">登录</button>
                            </div>
                            <div style="border:0;text-align:center;height: 50px;"></div>
                        </div>

                    </div>
                </td>
                <td><div class="sx-bg-right"></div></td>
            </tr>
        </table>
    </div>

    </body>
  <!--<div class="login-logo">-->
    <!--<b>开发框架</b>-->
  <!--</div>-->
  <!--<div class="login-box-body">-->
      <!--<p class="login-box-msg">管理员登录</p>-->
      <!--<div v-if="error" class="alert alert-danger alert-dismissible">-->
        <!--<i class="fa fa-exclamation-triangle"></i> {{errorMsg}}-->
      <!--</div>-->
      <!--<div class="form-group has-feedback">-->
        <!--<input type="text" class="form-control" v-model="username" placeholder="账号">-->
        <!--<span class="glyphicon glyphicon-user form-control-feedback"></span>-->
      <!--</div>-->
      <!--<div class="form-group has-feedback">-->
        <!--<input type="password" class="form-control" v-model="password" placeholder="密码">-->
        <!--<span class="glyphicon glyphicon-lock form-control-feedback"></span>-->
      <!--</div>-->
      <!--<div class="form-group has-feedback">-->
        <!--<input type="text" class="form-control" v-model="captcha" @keyup.enter="login" placeholder="验证码">-->
        <!--<span class="glyphicon glyphicon-warning-sign form-control-feedback"></span>-->
      <!--</div>-->
      <!--<div class="form-group has-feedback">-->
        <!--<img alt="如果看不清楚，请单击图片刷新！" class="pointer" :src="src" @click="refreshCode">-->
        <!--&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:;" @click="refreshCode">点击刷新</a>-->
      <!--</div>-->
      <!---->
      <!--<div class="row">-->
        <!--<div class="col-xs-8">-->
          <!--<div class="checkbox icheck">-->
          <!--</div>-->
        <!--</div>-->
        <!--<div class="col-xs-4">-->
          <!--<button type="button" class="btn btn-primary btn-block btn-flat" @click="login">登录</button>-->
        <!--</div>-->
      <!--</div>-->
  <!--</div>-->
</div>



<script src="statics/libs/vue.min.js"></script>
<script type="text/javascript">
var vm = new Vue({
	el:'#dpLTE',
	data:{
		username: 'System',
		password: '1',
		captcha: '888888',
		error: false,
		errorMsg: '',
		src: 'sys/captcha.jpg'
	},
	beforeCreate: function(){
		if(self != top){
			top.location.href = self.location.href;
		}
	},
	methods: {
		refreshCode: function(){
			this.src = "sys/captcha.jpg?t=" + $.now();
		},
		login: function (event) {
			if(vm.username == '') {
				vm.error = true;
				vm.errorMsg = '用户名为空';
				return false;
			}
			if(vm.password == '') {
				vm.error = true;
				vm.errorMsg = '密码为空';
				return false;
			}
			if(vm.captcha == '') {
				vm.error = true;
				vm.errorMsg = '验证码为空';
				return false;
			}
			var data = "username="+vm.username+"&password="+vm.password+"&captcha="+vm.captcha;
			$.ajax({
				type: "POST",
			    url: "sys/login",
			    data: data,
			    dataType: "json",
			    success: function(result){
					if(result.code == 0){//登录成功
						parent.location.href ='index_tab.html';
					}else{
						vm.error = true;
						vm.errorMsg = result.msg;
						
						vm.refreshCode();
					}
				}
			});
		}
	}
});
</script>
</body>
</html>
